package com.cheng.operation.impl;

import com.cheng.common.exception.CommonException;
import com.cheng.data.entity.AcptTypeInfEntity;
import com.cheng.operation.AcptTypeInfOperation;
import com.cheng.service.AcptTypeInfService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author: ChengJW
 * @date: 2021/11/7 23:48
 * @version: 1.0
 * @description: 有关受理状态信息表 acpt_type_inf 表的逻辑操作
 */
@Service
public class AcptTypeInfOperationImpl implements AcptTypeInfOperation {

    private final static Logger log = LoggerFactory.getLogger(AcptTypeInfOperationImpl.class);

    @Autowired
    private AcptTypeInfService acptTypeInfService;

    /**
     * @author: ChengJW
     * @params: [entity]
     * @return: java.util.List<com.cheng.data.entity.AcptTypeInfEntity>
     * @date: 2021/11/9
     * @description: 查询受理状态信息表
     */
    @Override
    public List<AcptTypeInfEntity> queryAcptTypeInf(AcptTypeInfEntity entity) throws CommonException {
        return acptTypeInfService.queryAcptTypeInf(entity);
    }

    /**
     * @author: ChengJW
     * @params: [code]
     * @return: java.lang.String
     * @date: 2021/11/9
     * @description: 根据受理状态代码查询受理状态名称
     */
    @Override
    public String queryAcptTypeInfNmByCode(String code) throws CommonException {

        AcptTypeInfEntity entity = new AcptTypeInfEntity();
        entity.setAfTypeCode(code);
        List<AcptTypeInfEntity> list = acptTypeInfService.queryAcptTypeInf(entity);
        String afTypeNm = "";
        if (null != list && list.size()  > 0){
            afTypeNm = list.get(0).getAfTypeNm();
        }
        return afTypeNm;
    }


}
